Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow containers to access files labeled as cert_t #7061

Closed

Conversation

asm0deuz
Copy link
Collaborator

Initially binding /etc/pki/ca-trust/extracted:z to mon/rgw containers
was done to solve an OSP TripleO issue on RHEL
(#3638) but by using the z flag it
brought other issues like https://bugzilla.redhat.com/show_bug.cgi?id=2026953
The z flag prevents local services (like sssd) running on the host accessing
the certificates/files in that folder.

Solving this requires to modify the ceph-selinux package to allow
container_t flagged processes to have access to files/folders labelled with
cert_t and use ro instead of z flag.

2 PR are created to solve this issue. One for ceph-selinux (ceph/ceph#44802) and another one for
ceph-ansible (this one)

Signed-off-by: Teoman ONAY tonay@redhat.com

Initially binding /etc/pki/ca-trust/extracted:z to mon/rgw containers
was done to solve an OSP TripleO issue on RHEL
(ceph#3638) but by using the z flag it
brought other issues like https://bugzilla.redhat.com/show_bug.cgi?id=2026953
The z flag prevents local services (like sssd) running on the host accessing
the certificates/files in that folder.

Solving this requires to modify the ceph-selinux package to allow
container_t flagged processes to have access to files/folders labelled with
cert_t and use ro instead of z flag.

2 PR are created to solve this issue. One for ceph-selinux and another one for
ceph-ansible.

Signed-off-by: Teoman ONAY <tonay@redhat.com>
state: present

- name: restore certificates selinux context
command: /usr/sbin/restorecon -RF /etc/pki/ca-trust/extracted
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you please say more about the problem?

What file in /etc/pki/ca-trust/extracted is mis-labeled?

What is the thing that's mis-labeling it in the first place?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the mon and rgw containers need to get access to the local folder /etc/pki/ca-trust/extracted and its content, this line https://github.com/ceph/ceph-ansible/blob/c491e67486d8ed2717b5b9eda96544eb4f7eae2d/roles/ceph-rgw/templates/ceph-radosgw.service.j2#L42 relabels the whole folder content with container_t at container startup. While it gives access to the container(s) it prevents local processes like sssd to access the files. Unfortunately just changing the flag from z to ro does not put back the cert_t label on the files, this is why that restorecon is necessary.

I hope having answered your question.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in two weeks if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Feb 12, 2022
@guits guits removed the stale label Feb 14, 2022
@github-actions
Copy link

github-actions bot commented Mar 1, 2022

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in two weeks if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Mar 1, 2022
@asm0deuz asm0deuz closed this Mar 4, 2022
@asm0deuz asm0deuz deleted the fix_selinux_containers_mon_rgw branch March 4, 2022 13:06
@asm0deuz asm0deuz restored the fix_selinux_containers_mon_rgw branch March 4, 2022 13:07
@asm0deuz asm0deuz deleted the fix_selinux_containers_mon_rgw branch March 4, 2022 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants